package com.cxyzy.commonviewholderlib

import android.content.Context

/**
 * 单一布局统一adapter
 */

abstract class SimpleCommonAdapter<T>(context: Context, data: List<T>, protected var mLayoutId: Int) : BaseCommonAdapter(context, data) {

    override fun getLayoutIdByType(viewType: Int): Int {
        return mLayoutId
    }

    override fun getItemViewType(position: Int): Int {
        return 0
    }

    @Suppress("UNCHECKED_CAST")
    override fun onBindViewHolder(holder: ViewHolder, type: Int, data: Any, position: Int) {
        onBindViewHolder(holder, data as T, position)
    }

    protected abstract fun onBindViewHolder(holder: ViewHolder, data: T, position: Int)

}